{% extends "FOSUserBundle:Registration:register.html.twig" %}

{% block head %}
{{parent()}}
{% if is_granted("IS_AUTHENTICATED_REMEMBERED") %}
	<meta http-equiv="refresh" content="1; url={{path('cadss_test_homepage')}}" />
	<script type="text/javascript">
            window.location.href = "{{path('cadss_test_homepage')}}"
    </script>
{% endif %}
{% endblock head %}

{% block fos_user_content %}		
		{#
			{% for user in users %}			
				<p>{{ user.id }}   {{ user.username }}   {{ user.email }}</p>
			{% endfor %}
		#}
		{% if is_granted("IS_AUTHENTICATED_REMEMBERED") %}	
			<div class="toast">	{{ 'layout.logged_in_as'|trans({'%username%': app.user.username}, 'FOSUserBundle') }}
				<img src="{{ asset('img/close.png') }}" witdh="16" height="16" onclick="this.parentNode.style.display='none'"/>
			</div>
		{% else %}
			{% for error in form.plainPassword.first.vars.errors %}
                <div class="toast">{{ error.message }}<img src="{{ asset('img/close.png') }}" witdh="16" height="16" onclick="this.parentNode.style.display='none'"/></div>
            {% endfor %} 
        {% endif %}      
		
		<div id="dragme" class="login unselectable">	
		<form action="{{ path('fos_user_registration_register') }}" {{ form_enctype(form) }} method="POST" class="fos_user_registration_register">

			<table>
				<tr>
					<td><label for="fos_user_registration_form_username" class="required">{{ 'form.username'|trans({}, 'FOSUserBundle') }}</label></td>
					<td><input type="text" id="fos_user_registration_form_username" autocomplete="off" name="fos_user_registration_form[username]" required="required" pattern=".{2,}" /></td>
				</tr>
				<tr>
					<td><label for="fos_user_registration_form_email"  class="required">{{ 'form.email'|trans({}, 'FOSUserBundle') }}</label></td>
					<td><input type="email" id="fos_user_registration_form_email" autocomplete="off" name="fos_user_registration_form[email]" required="required" /></td>
				</tr>
				<tr>
					<td><label for="fos_user_registration_form_plainPassword_first" class="required">{{ 'form.password'|trans({}, 'FOSUserBundle') }}</label></td>
					<td> <input type="password" autocomplete="off" id="fos_user_registration_form_plainPassword_first" name="fos_user_registration_form[plainPassword][first]" required="required" /></td>
				</tr>
				<tr>
					<td><label for="fos_user_registration_form_plainPassword_second"  class="required">{{ 'form.password_confirmation'|trans({}, 'FOSUserBundle') }}</label></td>
					<td><input type="password" autocomplete="off" id="fos_user_registration_form_plainPassword_second" name="fos_user_registration_form[plainPassword][second]" required="required" /></td>
				</tr>			
				<td colspan="2">
				<input type="submit" value="{{ 'registration.submit'|trans({}, 'FOSUserBundle') }}" /></td> </tr>			
				<tr><td colspan="2" id="register"><a href="{{ path('fos_user_security_login') }}">{{ 'layout.login'|trans({}, 'FOSUserBundle')|lower }}</a></td></tr>
			</table>			
			{{ form_row(form._token) }}
		</form>
		</div>
	
{% endblock fos_user_content %}


